<template>
	<view>
		<view class="container">
		<view class="attentionItem flex flexBei" v-for="(item, index) in fansList" :key="index" @click="navtoUserInfo(item.user_id)">
			<view class="attentionItem_content flex">
				<image :src="item.hesd_portrait" ></image>
				<view class="attentionItem_info">
					<view class="title">
						{{item.name}}
					</view>
					<view class="attentionItem_instoduction textHd">
						{{item.user_motto}}
					</view>
				</view>
			</view>
			<view class="time">{{item.time}}</view>
		</view>
		</view>
		<!-- 内容为空 -->
		<u-empty mode="list" text="暂无粉丝" margin-top="240" v-show="(this.fansList.length == 0)"></u-empty>
        <!-- 提示栏 -->
        <u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import { getfollow } from '../../api/follow_like.js'
	export default {
		data() {
			return {
				isNoMore: false,
				total: '',
				params: {
				  mineId: '',
				  pageNum: 1,
				  pageSize: 12
				},
				fansList: []
			}
		},
		onLoad() {
		  this.params.mineId = this.$store.state.userinfo.userId
		  uni.setNavigationBarTitle({
		  	title: '粉丝'
		  })	
		},
		mounted() {
		  this.getFansList()
		},
		onReachBottom() {
			if (this.total >= (this.params.pageNum *this.params.pageSize)) {
				 this.getMore()
			} else {
				this.$refs.uToast.show({
					title: '没有数据了',
					position: 'top'
					})
			}
		},
		methods: {
		  // 获取粉丝列表
		  async getFansList () {
			const res = await getfollow(this.params)
			this.fansList = res.data.data.data
			this.total = res.data.data.total
		  },
		  // 加载下一页数据
		  async getMore () {
			  this.params.pageNum ++
			  const params = this.params
			  const res = await getfollow(this.params)
			  this.fansList = [...this.fansList, ...res.data.data.data] 
		  },
		  // 跳转到用户详情
		  navtoUserInfo (id) {
			  uni.navigateTo({
			  	url: `../user_details/user_details?id=${id}`
			  })
		  }
		}
	}
</script>

<style lang="less" scoped>
/* 盒子 */
.container {
	margin-top: 30rpx;
}
/* 关注列表 */
.time {
	height: 80rpx;
	line-height: 80rpx;
}
.attentionItem_info {
	width: 620rpx !important
}
</style>
